package com.lebron.kotlin.ui.present.impl

import com.lebron.kotlin.bean.movie.TheaterBean
import com.lebron.kotlin.bean.movie.USTheaterBean
import com.lebron.kotlin.http.ApiCompleteListener
import com.lebron.kotlin.ui.model.impl.MovieListModelImpl
import com.lebron.kotlin.ui.present.MovieListPresentI
import com.lebron.kotlin.ui.view.MovieListView

/**
 * @Author lebron
 * @Date 18-7-26-下午3:54
 */
class MovieListPresentImpl : BasePresentImpl<MovieListView>() , MovieListPresentI,ApiCompleteListener<TheaterBean,USTheaterBean>{
    override fun onSuccess(b: USTheaterBean) {
        checkNet()
        view?.setUSBox(b)
    }

    override fun getComingSoon(start: Int, count: Int) {
        checkNet()
        movieListModel.getComingSoon(start,count)
    }

    override fun getTop250(start: Int, count: Int) {
        checkNet()
        movieListModel.getTop250(start,count)
    }

    override fun getUSBox(start: Int, count: Int) {
        checkNet()
       movieListModel.getUSBox(start,count)
    }


    private val movieListModel: MovieListModelImpl = MovieListModelImpl(this)

    override fun onComplete(t: TheaterBean) {
        view?.setTheaterData(t)
    }

    override fun onFailed(error: String) {
        view?.onError(error)
    }


    override fun getTheaterData(start:Int,count:Int) {
        movieListModel.getTheater(start,count)
    }


}